/*
 * @Author: 孙开源 && sunkaiyuan@namenode.cn
 * @Date: 2023-07-01 14:25:42
 * @LastEditors: 孙开源 && sunkaiyuan@namenode.cn
 * @LastEditTime: 2023-07-02 09:38:35
 * @Description: 
 * 
 */
import { VXETable } from 'vxe-table'
import XEUtils from "xe-utils";
import FormRender from './components/formRender.vue'
// import XEUtils from 'xe-utils'
// 创建一个简单的输入框渲染
VXETable.renderer.add('formRender', {
  // 激活时自动聚焦
  autofocus: '.my-cell',
  // 可编辑激活模板
  renderItemContent(renderOpts, params) {
    const { data, field, item } = params;
    params['column'] = { filterRender: { attrs: item.itemRender } };

    return [
      <FormRender params={params} renderOpts={renderOpts} v-model={data[field]} class="my-cell" clearable></FormRender>
    ]
  },
  itemResetMethod(params) {
    const { data, field, item } = params;
    XEUtils.set(data, field, item.itemRender.defaultvalue);
  }

})
